package com.avecsys.quotemanager.service.common;

import java.util.List;

import com.avecsys.quotemanager.dao.common.BaseDAO;
import com.avecsys.quotemanager.exception.BusinessException;
import com.avecsys.quotemanager.exception.DAOException;
import com.avecsys.quotemanager.pojos.CountryMasterPojo;

public class CommonServiceImpl implements CommonService {

	private BaseDAO baseDAO;

	/**
	 * @return the baseDAO
	 */
	public BaseDAO getBaseDAO() {
		return baseDAO;
	}

	/**
	 * @param baseDAO
	 *            the baseDAO to set
	 */
	public void setBaseDAO(BaseDAO baseDAO) {
		this.baseDAO = baseDAO;
	}

	/**
	 * Method to return all the Countries
	 * 
	 * @param countryMasterPojo
	 * @return List<CountryMasterPojo>
	 * @throws BusinessException
	 */
	@Override
	public List<CountryMasterPojo> getAllCountries(
			CountryMasterPojo countryMasterPojo) throws BusinessException {
		List<CountryMasterPojo> countryMasterPojoList = null;
		try {
			countryMasterPojoList = baseDAO.findAll(countryMasterPojo);
		} catch (DAOException e) {
			throw new BusinessException(e);
		}
		return countryMasterPojoList;
	}

}
